﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cwi.Utils
{
    public static class StringExtensions
    {
        public static string PascalToWord(this string str)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return str;
            }

            var stringBuilder = new StringBuilder();
            for (var i = 0; i < str.Length; i++)
            {
                if (char.IsUpper(str[i]) && i > 0)
                {
                    stringBuilder.Append(' ');
                }

                stringBuilder.Append(str[i]);                
            }

            return stringBuilder.ToString();
        }
    }
}
